package erwiki.ui.app.admin.handlers.workaround2;

import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell;

import erwiki.api.core.Engine;
import erwiki.api.exceptions.ProviderException;
import erwiki.api.pages.PageManager;
import erwiki.api.providers.PageProvider;
import jakarta.inject.Inject;

/**
 * Обновление ссылок page2page.
 *
 * @author vfedorov
 */
public class PagesRefreshRefsHandler {

	@Inject
	Engine engine;

	@Execute
	public void execute(Shell shell) {
		PageManager pm = engine.getManager(PageManager.class);
		PageProvider pp = pm.getCurrentProvider();
		try {
			pp.fvkPagesRefreshReferences();
		} catch (ProviderException e) {
			MessageDialog.openError(shell, "Error PagesRefreshRefsHandler", e.getMessage());
		}
	}

}
